#!/bin/bash

operator=(0 + - \* /)

menu(){
        echo "1.add"
        echo "2.minus"
        echo "3.multiplication"
        echo "4.division"
        echo "5.compare"
        echo "6.exit"
        read -p "please choose:" choice
}

main(){
while :
do
        echo '####################'
        menu
        case $choice in
          [1-4])
		read -p "please input 2 number:" num1 num2
		echo -n "${num1}${operator[choice]}${num2}="
                echo "${num1} ${num2}" | awk "{print \$1${operator[choice]}\$2}" 
		;;
          5)
		read -p "please input 2 number:" num1 num2
		echo "${num1} ${num2}" | awk '{if ($1>$2) print $1">"$2; else if($1<$2) print $1"<"$2; else print $1"="$2}'
		;;
          6)
                exit ;;
          *)
                exit ;;
        esac
done
}

main
